<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Iwiotss-Signup</title>
    <link rel="stylesheet" href="{{ url_for('static',filename='title.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='login.css') }}">
    <link rel="shortcut icon" href="{{ url_for('static',filename='favicon.ico') }}" type="image/x-icon">
    <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.7.1.min.js"></script>
    <script>
        const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);

        if (isMobile) {
            window.location.href = "/msignup";
        }
        // window.onload = function () {
        //     function getWindowInfo() {
        //         const windowInfo = {
        //             width: window.innerWidth,
        //             height: window.innerHeight // 修正了属性名
        //         };
        //         if (windowInfo.width <= 1200) {
        //             window.location.href = "/msignup"; // 确保这里的URL是有效的
        //         }
        //     }

        //     // 初始调用，检查页面加载时的窗口大小
        //     getWindowInfo();

        //     // 监听窗口大小变化事件
        //     window.addEventListener('resize', getWindowInfo);
        // };  
    </script>

</head>

<body>
    <div class="title">
        <div class="top">
            <div class="logo"><a href="/">Iwiotss</a></div>
            <ul>
                <li><a href="{{ url_for('home') }}">首页</a></li>
                <li><a href="{{ url_for('about') }}">关于</a></li>
                <li><a href="{{ url_for('login') }}">登录</a></li>
            </ul>
        </div>
    </div>
    <section>
        <div class="loginblock">
            <p>注册</p>
            <form action="{{ url_for('signup') }}" method="POST">
                <div class="input">账号 <input type="text" id="username" name="username" required></div>
                <div class="input">密码 <input type="password" id="password" name="password" required></div>
                <div class="input">确认 <input type="password" id="confirmPassword" name="confirmPassword" required
                        onchange="check()"></div>
                <div class="btnArea">
                    <button type="submit" id="signup">注册</button>
                </div>
                <script>
                    $(document).ready(function () {
                        $("#signup").hide();
                    });

                    function check() {
                        var password = document.getElementById("password");
                        var confirmPassword = document.getElementById("confirmPassword");
                        if (password.value == confirmPassword.value) {
                            $("#signup").show();
                        }
                    }
                </script>
            </form>
        </div>
    </section>
</body>

</html>